<%@ page language="java" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
${aier_doctype}
<html <s:property value="aier-html-xmlns" escape="false"/>>
<head>
<meta http-equiv="Content-Type" content="${aier_content_type}" />
<meta name="keywords" content="${aier_keyworks}" />
<meta name="description" content="${aier_description}" />
<title>${aier_title}</title>
<link rel="stylesheet" href="${aier_css_url}${aier_jqui_css}ui.css" />
<link rel="Stylesheet" href="${aier_css_url}jq/jq.css" />
<link rel="stylesheet" href="${aier_css_url}social/module/jq-msg.css" />
<link rel="stylesheet"
	href="${aier_css_url}social/module/reset.css" />
<link rel="stylesheet"
	href="${aier_css_url}social/user/accountSettings/common.css" />
<link rel="stylesheet"
	href="${aier_css_url}social/user/accountSettings/pi.css" />

<script type="text/javascript" src="${aier_js_url}j.js"></script>
<script type="text/javascript" src="${aier_js_url}b.js"></script>
<script type="text/javascript" src="${aier_js_url}jp/hh/ui.js"></script>
<script type="text/javascript" src="${aier_js_url}jp/msg.js"></script>

<script type="text/javascript" src="${aier_js_url}97/WdatePicker.js"></script>
<script type="text/javascript" src="${aier_js_url}jq/cn.js"></script>
<script type="text/javascript" src="${aier_js_url}jq/jq.js"></script>
<script type="text/javascript" src="${aier_js_url}lib/block.js"></script>
</head>
<!-- 我的班级页面 -->
<body>
	<!-- 顶栏 -->
	<s:action name="userhomecomm_homeHead" namespace="/user"
		executeResult="true"></s:action>

	<!-- 正文 -->
	<div id="hfContent" class="ar-content">
		<div class="content-main">
			<div class="main-content wrap-bg clearfix">
				<!-- 左侧栏 -->
				<s:action name="useraccountsettings_aSettingsLeft" namespace="/user"
					executeResult="true"></s:action>
				<!-- 右侧内容 -->
				<div class="ae-right">
					<div class="right-main">
						<div class="right-main-top">
							<div class="binfo-title">
								<h3>我的班级</h3>
							</div>
							<div class="right-line"></div>
						</div>
						<div class="right-main-c clearfix" id="myShowClass">
							
							
							
						</div>
					</div>
				</div>

			</div>

		</div>
		<!-- footer copyright -->
		<s:action name="userhomecomm_homeFooter" namespace="/user" executeResult="true"></s:action>
		<!-- /footer copyright -->
	</div>
</body>
<script type="text/javascript">
	$(document).ready(function() {
		load_classes();
	});

	//加载班级
	function load_classes(){
		var fun = function(data){
			var msg_html = "";
			if (data.classParentList != null&&data.classParentList.length > 0) {
				for( var i = 0; i < data.classParentList.length; i++ ){
					var cid = data.classParentList[i].cid;
					var name_classes = data.classParentList[i].name_classes;
					var name_student = data.classParentList[i].name_student;
					var relation = data.classParentList[i].relation; 
					var clogo = data.classParentList[i].clogo;
					msg_html += "<div class='class-item clearfix'><a href='javascript:;' class='class-item-avatar'>" + 
							"<img src='${classlogo_get_url}small/"+clogo+"' width='50' height='50' ></a>" +
							"<div class='class-item-right'>" +
							"<p><label>班级：</label> "+name_classes+"</p>" +
							"<p><label>身份：</label>"+relation+"</p>" +
							"<p style='visibility: visible'><label>我的孩子：</label>"+name_student+"</p>" +
							"<p class='class-item-acts'><a href='javascript:;' class='button20'data-action='dropClass'" +
							" onclick='delete_p("+cid+");'><em>退出班级</em></a></p></div></div>";
				}
			}
			if (data.classTeacherList != null&&data.classTeacherList.length > 0) {
				for( var i = 0; i < data.classTeacherList.length; i++ ){
					var cid = data.classTeacherList[i].cid;
					var name_classes = data.classTeacherList[i].name_classes;
					var name_teacher = data.classTeacherList[i].name_teacher;
					var clogo = data.classTeacherList[i].clogo;
					msg_html += "<div class='class-item clearfix'><a href='javascript:;' class='class-item-avatar'>" + 
							"<img src='${classlogo_get_url}small/"+clogo+"' width='50' height='50' ></a> " +
							"<div class='class-item-right'>" +
							"<p><label>班级：</label> "+name_classes+"</p>" +
							"<p><label>身份：</label>教师</p>" +
							"<p style='visibility: visible'><label>教师名：</label>"+name_teacher+"</p>" +
							"<p class='class-item-acts'><a href='javascript:;' class='button20'data-action='dropClass' " +
							" onclick='delete_t("+cid+");'><em>退出班级</em></a></p></div></div>";
				}
			}			
			$("#myShowClass").html(msg_html);
		};
		exeAjax(ajaxUrl("${aier_url}${aier_urijs}useraccountsettings_showMyclassList${aier_suffix}"), fun, {});		
	}
	
	//退出班级 家长身份 
	function delete_p(cid){
		if(confirm("确定退出班级吗?")){
			var fun = function(data) {
				load_classes();
			};
			exeAjax(ajaxUrl("${aier_url}${aier_urijs}useraccountsettings_deleteParentClass${aier_suffix}"), fun, 
				{"cid" :cid});		
		}
	}

	//退出班级 教师身份 
	function delete_t(cid){
		if(confirm("确定退出班级吗?")){
			var fun = function(data) {
				load_classes();
			};
			exeAjax(ajaxUrl("${aier_url}${aier_urijs}useraccountsettings_deleteTeacherClass${aier_suffix}"), fun, 
				{"cid" :cid});		
		}
	}	
	
</script>

</html>